home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.2r / card_37891.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  153 lines

  1. -- card: 37891 from stack: in.2r
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 14090
  5. -- name: massCompact
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 00
  10. -- high flags: 0004
  11. -- rect: left=120 top=90 right=218 bottom=399
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: desc
  20.  
  21.  
  22. -- part 2 (button)
  23. -- low flags: 00
  24. -- high flags: A003
  25. -- rect: left=191 top=231 right=260 bottom=336
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Multiple Compact
  34. ----- HyperTalk script -----
  35. function FolderPath name
  36. --
  37. -- FolderPath -- given a file pathname, returns whatever comes
  38. -- before the last colon, if anything (should be a folder or disk name).
  39. -- From Dewi Williams; modified by John Koch
  40. --
  41. -- scan backwards for the last colon.
  42. repeat with i = the length of name down to 1
  43.   if character i of name is ":" then exit repeat
  44. end repeat
  45. subtract 1 from i -- before the colon
  46. -- Name was of the form "Thing:otherthing". Return "Thing".
  47. put empty into lastpath
  48. if i > 0 then put char 1 to i of name into lastpath
  49. return lastpath
  50. end FolderPath
  51.  
  52.  
  53. on mouseUp
  54.   --*****************************************************
  55.   --*    MASS COMPACTER   by Brian D. McLean, D.D.S.    *
  56.   --*                        CIS: 75026,3724            *
  57.   --*                        GEnie: B.McLean            *
  58.   --*                                                   *
  59.   --*    Modified by John A. Koch   2/27/88             *
  60.   --*                CIS: 72457,736                     *
  61.   --*                                                   *
  62.   --*    Modifications:                                 *
  63.   --*      1. Uses FileName() XFCN to select folder.    *
  64.   --*      2. Can only compact stack if userlevel is    *
  65.   --*         greater than 2 since "Compact Stack" is   *
  66.   --*         not in the menu at level 1 or 2.          *
  67.   --*      3. Does not count space for a stack it       *
  68.   --*         cannot compact.                           *
  69.   --*                                                   *
  70.   --*   uses the XFCN Files()    by Guy de Picciotto    *
  71.   --*                               CIS: 73300,3637     *
  72.   --*                               GENIE: G.PICCIOTO   *
  73.   --*                                                   *
  74.   --*   uses the XFCN FileName() by Steve Maller        *
  75.   --*                               Apple Computer      *
  76.   --*                               AppleLink: Maller1  *
  77.   --*                               Delphi: stevemaller *
  78.   --*                               MCI Mail: smaller   *
  79.   --*****************************************************
  80.   -- **** DON'T FORGET TO MOVE THE FILES() AND FILENAME() XFCNs SO
  81.   -- THAT THEY WILL BE AVAILABLE TO THE SCRIPT.
  82.   -- USE RESEDIT OR RESCOPY FOR THIS.
  83.   if the optionkey is down then pass mouseup
  84.  
  85.   put the userlevel into Oldlevel
  86.   put FileName("STAK") into compacterPath
  87.   go to this card  -- redraws card
  88.   --use the 2 lines below to create a default pathname if desired.
  89.   --if compacterPath is empty then put "Mydisk:Lotsa Stacks" into --compacterPath
  90.   if compacterPath is empty then
  91.     exit to hypercard
  92.   end if
  93.   put FolderPath(compacterPath) into compacterPath
  94.   if compacterPath is empty then
  95.     answer "Problems with this folder name" with "Too bad"
  96.     exit to hypercard
  97.   end if
  98.   Put Files(compacterPath,"STAK") into stacknames
  99.   push card
  100.   put zero into examined
  101.   put zero into compacted
  102.   put zero into saved
  103.   set the cursor to 4  -- it is the watch
  104.   set lockmessages to true
  105.   set lockscreen to true
  106.   repeat with x = 1 to number of lines of stacknames
  107.     if the shiftKey is down then
  108.       put "Checking halted" into msg
  109.       set the userlevel to Oldlevel
  110.       set lockmessages to false
  111.       set lockscreen to false
  112.       exit mouseup
  113.     end if
  114.     put line x of stacknames into thisstack
  115.     put "Checking " & quote & thisstack & quote
  116.     add one to examined
  117.     put the freesize of stack thisstack into fsize
  118.     put " -- Freesize is" && fsize after msg
  119.     if fsize is zero then
  120.       wait 30
  121.     else
  122.       go to stack thisstack
  123.       set the userlevel to 3
  124.       if the userlevel > 2 then
  125.         put "Compacting" into first word of msg
  126.         add fsize to saved
  127.         doMenu "Compact Stack"
  128.         add one to compacted
  129.       end if
  130.     end if
  131.   end repeat
  132.   pop card
  133.   set lockmessages to false
  134.   set lockscreen to false
  135.   Put "All done!" && "Examined" && examined && "stacks; compacted" && compacted &&"to regain" && saved && "bytes."
  136.   wait 3 seconds
  137.   hide msg
  138.   set the userlevel to Oldlevel
  139. end mouseUp
  140.  
  141.  
  142.  
  143. -- part contents for background part 12
  144. ----- text -----
  145. massCompact
  146.  
  147. -- part contents for card part 1
  148. ----- text -----
  149. This button allows you to select a stack from a folder and automatically compacts all the stacks with wasted space in the same folder.  If you copy this button to another stack, you also need to install the Filename & Files XFCNs.
  150.  
  151. -- part contents for background part 5
  152. ----- text -----
  153. 8